<script setup lang="ts">
import { computed, inject } from 'vue'
import ScoutParamsContent
  from '@renderer/views/multiScanSeriesPage/components/ScoutContent/noImg/ScoutParamsContent.vue'
import NormalScanContent from '@renderer/views/multiScanSeriesPage/components/normalScanContent/NormalScanContent.vue'
import NoActiveSeries from '@renderer/views/multiScanSeriesPage/components/NoSeries/NoActiveSeries.vue'
import { EnumScanStatus, NormalScanSeries } from '@renderer/views/multiScanSeriesPage/types'
import ScoutImgContent from '@renderer/views/multiScanSeriesPage/components/ScoutContent/hasImg/ScoutImgContent.vue'
import { useScanStore } from '@renderer/store/pinia/scan'

const {
  scanSeriesArr,
  activeScanSeries
} = inject('multiSeries') as any

const scanStore = useScanStore()

const currentSeries = computed(() => {
  return scanStore.scanSeriesInfo.getSeriesById(activeScanSeries.id)
})


</script>

<template>
  <div class="w-full h-full">
    <keep-alive>
      <template v-if="scanSeriesArr.length === 0 || currentSeries  === null" >
        <no-active-series />
      </template>
      <template v-else-if="currentSeries instanceof NormalScanSeries">
        <normal-scan-content
          :seriesId="currentSeries.id"
          :imageIds="currentSeries.imageIds"
          :scoutImageIds="currentSeries.scoutImageIds"
        />
      </template>
      <template
        v-else-if="[EnumScanStatus.getting_img, EnumScanStatus.scan_img_folder_created].includes(currentSeries.status)">
        <scout-img-content
          :seriesId="currentSeries.id"
          :imageIds="currentSeries.imageIds"
          :scoutImageIds="currentSeries.imageIds"
        />
      </template>
      <template v-else>
        <scout-params-content
          :seriesId="currentSeries.id"
          :imageIds="currentSeries.imageIds"
          :scoutImageIds="currentSeries.imageIds"
        />
      </template>
    </keep-alive>
  </div>
</template>

<style scoped>

</style>
